package com.zsc.graduate.qovipan.sql;

import com.zsc.graduate.qovipan.util.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 枫树下奶罐
 * @version 1.0.0
 * @date 2022/4/19 17:43
 */
@SuppressWarnings("ALL")
@Mapper
public interface UserOpMapper {
    //根据id获取用户对象, 如果不存在返回null
    @Select("SELECT * FROM user WHERE id=#{id}")
    public User findByQid(@Param("id") Long id);

    //根据username获取用户对象, 如果不存在返回null
    @Select("SELECT * FROM user WHERE username=#{username}")
    public User findByName(@Param("username") String username);

    //列出所有用户
    @Select("SELECT * FROM user")
    public List<User>  findUserAll();
}
